package test0110;

// 能看懂程序实现什么功能吗?
public class Java07 {
    public static void main(String[] args) {
        int[] arr = {1, 2, 3, 4, 5};
        int sum = m(arr, 0);
        System.out.println(sum);
    }

    public static int m(int[] input, int index) {
        if (index == input.length - 1) {
            return input[index];
        } else {
            return input[index] + m(input, index + 1);
        }
    }
}
